SubscriptionRefType
SubscriptionRef
SubscriptionRef<'a> is a reference whose changes can be streamed. changes
starts with the value current when the stream starts, then delivers every later update, with no gap and no duplicate
between the two, buffered by a QueueStrategy chosen per stream.
Use it for state that consumers join at different times, such as a display opened after a feed started. Update it with
set, update, or
modify; each update reaches every running stream before the next starts.
Read the SubscriptionRef guide.
Specification
Kind
Type
Members
6
Examples
0
makeSignature
SubscriptionRef.make value
getSignature
SubscriptionRef.get reference
setSignature
SubscriptionRef.set value reference
updateSignature
SubscriptionRef.update mapping reference
modifySignature
SubscriptionRef.modify mapping reference
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Operations | ||
| make | SubscriptionRef.make value | Creates a reference holding value. |
| get | SubscriptionRef.get reference | Reads the current value. |
| set | SubscriptionRef.set value reference | Replaces the value and delivers it to every changes stream. |
| update | SubscriptionRef.update mapping reference | Applies a pure function to the value and delivers the result to every changes stream. |
| modify | SubscriptionRef.modify mapping reference | Computes a result and a new value together, stores the new value, and returns the result. |
| changes | SubscriptionRef.changes strategy reference | Streams the current value followed by every later update, buffered for this stream by strategy. |
Operations
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
Streams the current value followed by every later update, buffered for this stream by
strategy.
Parameters
| Name | Type | Description |
|---|---|---|
| strategy | QueueStrategy | |
| reference | SubscriptionRef<'a> |
Returns
FlowStream<'env, 'error, 'a>
Verification Examples
temperature
|> SubscriptionRef.changes (QueueStrategy.Sliding 1)
|> FlowStream.runForEach (printfn "%.1f")
